import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {};
// 表格字段
const tableColumn = {
  // 表格列表
  marketCouponTableMap: [
    {
      prop: 'id',
      type: 'text',
      label: 'ID',
    },
    {
      prop: 'name',
      type: 'text',
      label: '优惠券名称',
    },
    {
      prop: 'couponType',
      type: 'text',
      label: '优惠券类型',
    },
    {
      prop: 'color',
      type: 'text',
      label: '优惠券颜色',
    },
    {
      prop: 'reducePrice',
      type: 'text',
      label: '减免金额',
    },
    {
      prop: 'minPrice',
      type: 'text',
      label: '最低消费额',
    },
    {
      prop: 'discount',
      type: 'text',
      label: '折扣率(0-100)',
    },
    {
      prop: 'expireType',
      type: 'text',
      label: '到期类型',
    },
    {
      prop: 'expireEffectDay',
      type: 'text',
      label: '领券几天生效',
    },
    {
      prop: 'expireDay',
      type: 'text',
      label: '有效天数',
    },
    {
      prop: 'receiveNum',
      type: 'text',
      label: '已领取数量',
    },
    {
      prop: 'totalNum',
      type: 'text',
      label: '发放总数量',
    },
    {
      prop: 'content',
      type: 'text',
      label: '使用须知',
    },
    {
      prop: 'status',
      type: 'text',
      label: '状态',
      optionKey: 'COVERT_STATUS',
    }
  ],
};
// 表单字段
const editForm = {
  // 筛选表单
  marketCouponFilterMap: [
    {
      prop: 'name',
      type: 'input',
      label: '优惠券名称',
      col: 0,
    },
    {
      prop: 'couponType',
      type: 'select',
      label: '优惠券类型',
      optionKey: 'COUPON_TYPE',
      col: 0,
    },
    {
      prop: 'color',
      type: 'select',
      label: '优惠券颜色',
      optionKey: 'COUPON_COLOR',
      col: 0,
    },
    {
      prop: 'reducePrice',
      type: 'inputNumber',
      label: '减免金额',
      col: 0,
    },
    {
      prop: 'minPrice',
      type: 'inputNumber',
      label: '最低消费额',
      col: 0,
    },
    {
      prop: 'discount',
      type: 'inputNumber',
      label: '折扣率(0-100)',
      col: 0,
    },
    {
      prop: 'expireType',
      type: 'select',
      label: '到期类型',
      optionKey: 'COUPON_EXPIRES_TYPE',
      col: 0,
    },
    {
      prop: 'expireEffectDay',
      type: 'input',
      label: '领券几天生效',
      col: 0,
    },
    {
      prop: 'expireDay',
      type: 'inputNumber',
      label: '有效天数',
      col: 0,
    },
    {
      prop: 'receiveNum',
      type: 'inputNumber',
      label: '已领取数量',
      col: 0,
    },
    {
      prop: 'totalNum',
      type: 'inputNumber',
      label: '发放总数量',
      col: 0,
    },
    {
      prop: 'content',
      type: 'input',
      label: '使用须知',
      col: 0,
    },
    {
      prop: 'status',
      type: 'select',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      col: 0,
    },
    {
      prop: 'createTime',
      label: '创建时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
    {
      prop: 'updateTime',
      label: '更新时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
  ],
  // 新增/修改表单
  marketCouponFormMap: [
    {
      prop: 'name',
      type: 'input',
      label: '优惠券名称',
      col: 24,
    },
    {
      prop: 'couponType',
      type: 'select',
      label: '优惠券类型',
      optionKey: 'COUPON_TYPE',
      col: 24,
    },
    {
      prop: 'color',
      type: 'select',
      label: '优惠券颜色',
      optionKey: 'COUPON_COLOR',
      col: 24,
    },
    {
      prop: 'reducePrice',
      type: 'inputNumber',
      label: '减免金额',
      col: 24,
    },
    {
      prop: 'minPrice',
      type: 'inputNumber',
      label: '最低消费额',
      col: 24,
    },
    {
      prop: 'discount',
      type: 'inputNumber',
      label: '折扣率(0-100)',
      col: 24,
    },
    {
      prop: 'expireType',
      type: 'select',
      label: '到期类型',
      optionKey: 'COUPON_EXPIRES_TYPE',
      col: 24,
    },
    {
      prop: 'expireEffectDay',
      type: 'inputNumber',
      label: '领券几天生效',
      col: 24,
    },
    {
      prop: 'expireDay',
      type: 'inputNumber',
      label: '有效天数',
      col: 24,
    },
    {
      prop: 'receiveNum',
      type: 'inputNumber',
      label: '已领取数量',
      col: 24,
    },
    {
      prop: 'totalNum',
      type: 'inputNumber',
      label: '发放总数量',
      col: 24,
    },
    {
      prop: 'content',
      type: 'textarea',
      label: '使用须知',
      row: 3,
      col: 24,
    },
    {
      prop: 'status',
      type: 'radio',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      col: 24,
    }
  ],
};
// 其他映射
const otherMap = {};
// 表单字段校验
const editRule = {
  marketCouponFormRule: {
    name: [{ required: true, message: '优惠券名称不能为空', trigger: 'blur' }],
    couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'change' }],
    discount: [{ required: true, message: '折扣率不能为空', trigger: 'blur' }],
    expireType: [{ required: true, message: '请选择到期类型', trigger: 'blur' }],
    receiveNum: [{ required: true, message: '已领取数量不能为空', trigger: 'blur' }],
    totalNum: [{ required: true, message: '发放总数量不能为空', trigger: 'blur' }],
    status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  },
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule,
};
